/*
 * PlayerStats.h
 *
 *  Created on: Oct 8, 2011
 *  Created by: Devin Manno
 *  Updated by: Nick James, Devin Manno
 *	Last Update: Oct 14, 2011
 */

/*
 * This class contains stats specific to player objects
 */

#ifndef PLAYERSTATS_H_
#define PLAYERSTATS_H_
#include "CharacterStats.h"
#include "Character.h"
#include <string>
#include <ctime>
#include <cstdlib>

class PlayerStats: public CharacterStats{
    friend ostream& operator<<(ostream& out, PlayerStats& p)
    {
        p.saveCharacterStats(out);

        out << endl << p.experience << ',' << p.actionPointsType;
        return out;
    }
    friend istream& operator>>(istream& in, PlayerStats& p)
    {
        p.loadCharacterStats(in);
        char *tk = NULL;// pointers to chars
        char data[MAX] = ""; //to hold line
        in.getline(data,MAX - 1, '\n');
        tk = strtok(data, DELIMS); // get next token
        p.experience = atoi(tk);
        tk = strtok(NULL, DELIMS); // get next token
        p.actionPointsType = tk;
        return in;
    }
private:
	int experience;		// the character's experience
	std::string actionPointsType;	// Wizard uses "mana", Warrior uses "endurance", Rangers use "endurance"
	void generateStats(CharClass pClass);		// generate a random set of stats based on player's class

public:
	PlayerStats();
	PlayerStats(CharClass playerClass);
	PlayerStats(int agil, int str, int intel,
			int conc, int maxAP, int maxHP, int lvl, int AP,
			int HP) :
				CharacterStats(agil, str, intel, conc, maxAP, maxHP,
						lvl, AP, HP){
		experience = 0;
	}
	virtual ~PlayerStats();

	// getters
	int getExp() const;
	std::string getActionPointsType() const;

	// setters
	void setPlayerStats(int agil, int str, int intel,
			int conc, int maxAP, int maxHP, int lvl, int AP,
			int HP, std::string &APType);
	void setExp(int);
	void setActionPointsType(std::string apType);
};

#endif /* PLAYERSTATS_H_ */
